﻿using IAS.WEB.ViewModels;
using ServiceStack;
using ServiceStack.Auth;
using ServiceStack.Mvc;
using ServiceStack.OrmLite;
using System;
using System.Web.Mvc;
using System.Web.Security;

namespace IAS.WEB.Areas.Account.Controllers
{
    public class AccountController : ServiceStackController
    {
        // GET: Login
        public ActionResult Index()
        {
            var session = SessionAs<AuthUserSession>();
            var response = new HomeViewModel { Session = session };
            if (response.Session.UserAuthId != null)
            {
                var userAuthId = int.Parse(response.Session.UserAuthId);
                response.UserAuths = Db.Select<UserAuth>(x => x.Id == userAuthId);
                response.UserAuthDetails = Db.Select<UserAuthDetails>(x => x.UserAuthId == userAuthId);
            }

            return View(response);
        }

        
    }
}